import { createStore } from 'vuex'

const store = createStore({
    state() {
        return {
            identity: '',
            username: '',
            authToken: '',
            schoolName: ''
        }
    },
    mutations: {
        setIdentity(state, val) {
            state.identity = val
        },
        setUsername(state, val) {
            state.username = val
        },
        setToken(state, val) {
            state.authToken = val
            sessionStorage.setItem('token', val)
        },
        clearToken(state) {
            state.authToken = ''
            sessionStorage.setItem('token', '')
        },
        setSchoolName(state, val) {
            state.schoolName = val
        }
    },
    actions:{
        
    },
    modules: {
        
    }
})

export default store